import request from "@/router/axios";
import qs from "qs";

/**
 *
 * @param {Object} query 参数
 * @returns {Function} api
 */
export function getSysTreeList(query) {
  return request({
    url: "/task/taskNoticeConfigUser/getSysTreeList?portalLoading",
    method: "get",
    params: {
      isSystemConfig: query.isSystemConfig
    },
    headers: {
      "TENANT-ID": query.tenantId
    }
  });
}

/**
 * 保存每个列表切换状态
 * @param {Object} data 参数
 * @returns {Function} api
 */
export function saveItemState(data) {
  return request({
    url: "/task/taskNoticeConfigUser/saveItemState?portalLoading",
    method: "post",
    data
  });
}

/**
 * 获取任务类型和任务关系的数据
 * @param {Object} params 参数
 * @returns {Function} api
 */
export function getListByConfigId(params) {
  return request({
    url: "/task/taskNoticeConfigUserItem/getListByConfigId?portalLoading",
    method: "get",
    params,
    headers: {
      "TENANT-ID": params.tenantId
    }
  });
}

/**
 * 保存taskNotice数据
 * @param {Object} data 参数
 * @returns {Function} api
 */
export function saveAll(data) {
  return request({
    url: "/task/taskNoticeConfigUserItem/saveAll?portalLoading",
    method: "post",
    data: qs.stringify(data),
    headers: {
      "TENANT-ID": data.tenantId
    }
  });
}

/**
 * 保存el-switch isRemid 状态
 * @param {Object} data 参数
 * @returns {Function} api
 */
export function saveByIsRemind(data) {
  return request({
    url: "/task/taskNoticeConfigUserItem/saveByIsRemind?portalLoading",
    method: "post",
    data: qs.stringify(data),
    headers: {
      "TENANT-ID": data.tenantId
    }
  });
}
